<cfcomponent extends="Controller">
	<cffunction name="assessment">
		<cfscript>
			var documentID = 11;	
			document = {
				"main" = getAssessmentDocument(documentID),
				"insurance" = Model("document").findAll(include="insurance", where="consumerID=#PARAMS.key#", select="axis1,highestGAFinLastYear")
			};
		</cfscript>
	</cffunction>
	
	<cffunction name="getAssessmentDocument">
		<cfargument name="documentID" default="0">
		<cfscript>
			consumer = Model("consumer").findByKey(key=PARAMS.key, returnAs="query");
			insuranceDocuments = Model("document").findAll(include="assessment", where="id=#ARGUMENTS.documentID# AND consumerID=#PARAMS.key#");
		</cfscript>
		<cfquery name="document" dbtype="query">
			SELECT 	*, (consumer.firstName + ' ' + consumer.lastName) [consumerName]
			FROM 		insuranceDocuments, consumer 
			WHERE 	insuranceDocuments.consumerID = consumer.id
		</cfquery>
		<cfreturn document>
	</cffunction>
</cfcomponent>